home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_481 / turbomcp / turbomcp.asm < prev    next >
Assembly Source File  |  1992-05-06  |  54KB  |  1,505 lines

  1. ****************************************************************************
  2. *  Programme : turboMCP.asm                                                *
  3. *  Usage     : turboMCP                                                    *
  4. *  Version   : V0.009
  5. *  Date      : 09.-11.09.1990 and 08.12.1990 - 02.04.1991                  *
  6. *  Author    : Jörg Sixt                                                   *
  7. *  Purpose   : TRON-implementation ; file under "games"                    *
  8. *  Language  : A68K V2.41, Blink     (all PD! Isn't it wonderful?)         *
  9. *  NOTE      : This listing isn't meant to be an example of good           *
  10. *              programming. Shortness und speed of the code could only     *
  11. *              be reached at the cost of clarity. Sorry!                   *
  12. ****************************************************************************
  13.  
  14.              SECTION MAIN,CODE
  15. * ntsc/pal
  16. WIDTH:       EQU      320
  17. HGTNTSC:     EQU      200
  18. HGTPAL:      EQU      256
  19. JMPMAX:      EQU      4      ; max. pixels that can be jumped
  20. DELMAX:      EQU      10     ; max. speed (25/50 secs betw.)
  21. * exec
  22. EXECBASE:    EQU      $4
  23. ALLOCMEM:    EQU     -$C6
  24. FREEMEM:     EQU     -$D2
  25. OPENLIBRARY: EQU     -$228
  26. CLOSELIBRARY: EQU    -$19E
  27. WAITPORT:    EQU     -$180
  28. GETMSG:      EQU     -$174
  29. REPLYMSG:    EQU     -$17A
  30. * dos
  31. OPEN:        EQU     -$1E
  32. CLOSE:       EQU     -$24
  33. DELAY:       EQU     -$C6
  34. MODE_OLD:    EQU      1005
  35. * graphics
  36. CLEAREOL:    EQU     -$2A
  37. CLEARSCREEN: EQU     -$30
  38. TEXT:        EQU     -$3C
  39. SETSOFTSTYLE: EQU    -$5A
  40. DRAWELLIPSE: EQU     -$B4
  41. LOADRGB4:    EQU     -$C0
  42. MOVE:        EQU     -$F0
  43. DRAW:        EQU     -$F6
  44. SETRGB4:     EQU     -$120
  45. RECTFILL:    EQU     -$132
  46. READPIXEL:   EQU     -$13E
  47. WRITEPIXEL:  EQU     -$144
  48. SETAPEN:     EQU     -$156
  49. SETBPEN:     EQU     -$15C
  50. SETDRMD:     EQU     -$162
  51. CBUMP:       EQU     -$16E
  52. CMOVE:       EQU     -$174
  53. CWAIT:       EQU     -$17A
  54. VBEAMPOS:    EQU     -$180
  55. SCROLLRASTER: EQU    -$18C
  56. FREEVPORTCOPLISTS: EQU -$21C
  57. SCROLLVPORT: EQU     -$24C
  58. UCOPPERLISTINIT: EQU -$252
  59. * intuition
  60. CLOSESCREEN: EQU     -$42
  61. DISPLAYBEEP: EQU     -$60
  62. DRAWIMAGE:   EQU     -$72
  63. OPENSCREEN:  EQU     -$C6
  64. RETHINKDISPLAY: EQU  -$186
  65. * key codes
  66. DEL:         EQU      $73
  67. HELP:        EQU      $41
  68. ENTER:       EQU      $79
  69. CTRL:        EQU      $39
  70. ESC:         EQU      $75
  71. N8:          EQU      $83
  72. N2:          EQU      $C3
  73. N6:          EQU      $A1
  74. N4:          EQU      $A5
  75. UP:          EQU      $67
  76. DOWN:        EQU      $65
  77. RIGHT:       EQU      $63
  78. LEFT:        EQU      $61
  79. E:           EQU      $DB
  80. X:           EQU      $9B
  81. D:           EQU      $BB
  82. S:           EQU      $BD
  83. SPACE:       EQU      $7F
  84. * register
  85. CIA_KEY:     EQU      $BFEC01
  86. CIA_JFIRE:   EQU      $BFE001
  87. CIA_JOY1D:   EQU      $DFF00A
  88. CIA_JOY2D:   EQU      $DFF00C
  89.  
  90. * OPENLIB    LibName,LibBase,Errorlabel
  91. OPENLIB:     MACRO
  92.              lea      \1,a1
  93.              moveq    #0,d0
  94.              jsr      OPENLIBRARY(a6)
  95.              move.l   d0,\2
  96.              beq      \3
  97.              ENDM
  98. * CLOSELIB   LibBase
  99. CLOSELIB:    MACRO
  100.              move.l   \1,a1
  101.              jsr      CLOSELIBRARY(a6)
  102.              ENDM
  103. * DELSEC     1/50 secs
  104. DELSEC:      MACRO
  105.              move.l   Dosbase,a6
  106.              move.l   \1,d1
  107.              jsr      DELAY(a6)
  108.              ENDM
  109.  
  110. * ------------------------------------------------------------------
  111. * --                      Open Libraries                          --
  112. * ------------------------------------------------------------------
  113.              move.l   sp,SPbackup       ; proper WB/CLI-start
  114.              move.l   EXECBASE,a6
  115.              move.l   $114(a6),a1       ; Execbase->thisTask = my task
  116.              tst.l    $AC(a1)           ; started from CLI ?
  117.              bne      FromCLI
  118.              lea      $5C(a1),a2        ; ptr to MsgPort
  119.              move.l   a2,a0
  120.              jsr      WAITPORT(a6)      ; wait and...
  121.              move.l   a2,a0
  122.              jsr      GETMSG(a6)        ; ...got the message
  123.              move.l   d0,WBmsg          ; let's save the ptr
  124.  
  125. FromCLI:     OPENLIB  Dosname,Dosbase,ClosePrg
  126.              OPENLIB  Gfxname,Gfxbase,CloseDos
  127.              OPENLIB  Intname,Intbase,CloseInt  ; a couple of libs
  128.  
  129.              move.l   Dosbase,a6
  130.              move.l   #Rawname,d1
  131.              move.l   #MODE_OLD,d2
  132.              jsr      OPEN(a6)          ; where all the chars will go to
  133.              move.l   d0,Rawhandle
  134.              beq      CloseLibs
  135.  
  136. * ------------------------------------------------------------------
  137. * --                         The Menu Screen                      --
  138. * ------------------------------------------------------------------
  139. MainMenu:    bsr      OpenScreen
  140. * --------------- Gadget Boxes ------------------
  141.              move.l   Gfxbase,a6
  142.              move.l   #47,d7
  143.              lea      GBoxXYTab,a5   ; all the coordinates
  144. GBLoop:      move.l   Rastport,a1
  145.              move.w   (a5)+,d0
  146.              jsr      SETAPEN(a6)
  147.              move.l   Rastport,a1
  148.              move.w   (a5)+,d0
  149.              move.w   (a5)+,d1
  150.              move.w   (a5)+,d2
  151.              move.w   (a5)+,d3
  152.              jsr      RECTFILL(a6)
  153.              dbf      d7,GBLoop
  154. * ---------------- Gadget Titles ----------------
  155.              lea      GadTxtTab,a3
  156.              move.l   #0,d4
  157.              move.l   #3,d7
  158. TLoop1:      move.b   #3,d0           ; titles for first row
  159.              sub.b    d7,d0
  160.              move.b   d0,Gadnr
  161.              move.b   (a3)+,d4        ; get real colour
  162.              move.l   #0,d0
  163.              move.l   #19,d2
  164.              move.l   #9,d3
  165.              bsr      GTxt
  166.              sub.w    #11,a3          ; need the same text=same ptr
  167.              move.w   d4,d0           ; for shadow
  168.              move.l   #18,d2
  169.              move.l   #8,d3
  170.              bsr      GTxt
  171.              dbf      d7,TLoop1
  172.  
  173.              move.l   #8,d3           ; row 2-4
  174.              move.l   #8,d7
  175. TLoop2:      move.b   #12,d0
  176.              sub.b    d7,d0
  177.              move.b   d0,Gadnr
  178.              move.l   #13,d0
  179.              bsr      GTxt
  180.              dbf      d7,TLoop2
  181.  
  182.              move.l   Rastport,a1
  183.              move.l   #2,d0
  184.              move.l   d0,d1
  185.              jsr      SETSOFTSTYLE(a6) ; bold
  186.              move.l   #35,d2           ; row 5
  187.              move.l   #2,d7
  188. TLoop3:      move.b   #15,d0
  189.              sub.b    d7,d0
  190.              move.b   d0,Gadnr
  191.              move.l   #12,d0
  192.              bsr      GTxt
  193.              dbf      d7,TLoop3
  194. * -------------------  Put Cursor  --------------
  195.              move.l   Intbase,a6
  196.              move.l   Rastport,a0
  197.              lea      ArrowIStr,a1
  198.              move.l   #6,d0
  199.              move.l   #69,d1
  200.              jsr      DRAWIMAGE(a6)
  201. * ------------  Put Prefs to Screen  ------------
  202.              move.w   #12,d7
  203. PLoop:       move.b   d7,Gadnr
  204.              bsr      PutVal2Scr
  205.              dbf      d7,PLoop
  206. * ------------ Write 'SCROLL' Text --------------
  207.              lea      ScrollTxt,a5
  208.              move.b   #0,Gadnr
  209. TxtLoop:     move.l   Gfxbase,a6
  210.              move.l   Rastport,a1    ; SetSoftStyle(BOLD)
  211.              move.l   #2,d0
  212.              move.l   d0,d1
  213.              jsr      SETSOFTSTYLE(a6)
  214.              move.l   Rastport,a1    ; SetAPen(1)
  215.              move.l   #1,d0
  216.              jsr      SETAPEN(a6)
  217.              move.l   Rastport,a1    ; Move (80,95)
  218.              move.w   #80,d0
  219.              move.w   #95,d1
  220.              jsr      MOVE(a6)
  221.              move.l   Rastport,a1    ; Clear text line
  222.              jsr      CLEAREOL(a6)
  223.              move.l   Rastport,a1    ; Text(a5=Textptr,60)
  224.              move.l   a5,a0
  225.              move.w   #60,d0
  226.              jsr      TEXT(a6)
  227.              add.l    #60,a5         ; increase ptr to text
  228.              move.l   #30,d7         ; 30x Waitloop
  229.              tst.b    (a5)           ; end of text?
  230.              bne      WaitLoop       ; no -> continue now
  231.              lea      ScrollTxt,a5   ; yes-> go on with the beginning
  232. * ---------------  Boring, Boring,... -----------
  233. WaitLoop:    DELSEC   #6             ; ATTENTION multitasking freaks !!
  234.              bsr      Ask            ; Don't look at this routine!
  235.              cmp.b    #1,d0          ; (They gonna kill me..ughs..!)
  236.              bgt      Action         ; You want to move the Cursor ?
  237.              dbra     d7,WaitLoop
  238.              bra      TxtLoop        ; next piece of message
  239. * ---------- Newton: Action and Reaction  -------
  240. Action:      tst.b    d3             ; Fire ?
  241.              beq      MoveCursor     ; no  -> MoveCursor
  242.              move.l   #0,d0          ; yes -> you want to change the
  243.              move.b   Gadnr,d0       ;        prefs
  244.              lea      PrefsTab,a0
  245.              cmp.b    #3,d0          ; all "on/off"-Gadgets are
  246.              bgt      1$             ; handled with this
  247.              bchg.b   d0,(a0)
  248.              bra      4$
  249. 1$           cmp.b    #8,d0
  250.              bgt      2$
  251.              sub.b    #4,d0
  252.              bchg.b   d0,1(a0)
  253.              bra      4$
  254. 2$           cmp.b    #12,d0         ; Here are the "Value-Gaddies"
  255.              bgt      5$             ; e.g. speed, boxes, etc.
  256.              lea      LimitTab,a1    ; (Is "value" the right word ?
  257.              sub.b    #7,d0          ; How can a dictonairy be so cruel?)
  258.              add.w    d0,a0
  259.              sub.b    #2,d0
  260.              lsl.b    #1,d0
  261.              add.w    d0,a1
  262.              move.b   (a0),d0
  263.              add.b    #1,d0
  264.              cmp.b    (a1),d0        ; too big ?
  265.              ble      3$
  266.              move.b   1(a1),d0       ; begin at 0 respect. 1
  267. 3$           move.b   d0,(a0)
  268. 4$           bsr      PutVal2Scr
  269.              bra      WaitLoop
  270. 5$           cmp.b    #14,d0         ; last Row
  271.              bne      7$
  272.              lea      Bonus,a0       ; CLEAR
  273.              move.l   #20,d0
  274. 6$           move.b   #0,(a0)+
  275.              dbf      d0,6$
  276.              bra      WaitLoop
  277. 7$:          jsr      CloseScr       ; CloseScreen and...
  278.              cmp.b    #14,Gadnr
  279.              blt      Game           ; ...play
  280.              bgt      CloseRaw       ; ...or quit (never tested)
  281.  
  282. MoveCursor:  move.b   d2,-(sp)
  283.              move.b   d1,-(sp)
  284.              move.l   Gfxbase,a6       ; SetAPen for a successful Rectfill
  285.              move.l   Rastport,a1      ; to clear Cursor
  286.              move.b   Gadnr,d1
  287.              move.l   #10,d0
  288.              cmp.b    #3,d1
  289.              ble      1$
  290.              move.l   #7,d0
  291.              cmp.b    #12,d1
  292.              ble      1$
  293.              move.l   #4,d0
  294.  
  295. 1$           jsr      SETAPEN(a6)
  296.              bsr      GetXY            ; RectFill clears old cursor
  297.              move.w   d0,d2
  298.              add.w    #16,d2
  299.              move.w   d1,d3
  300.              add.w    #11,d3
  301.              move.l   Rastport,a1
  302.              jsr      RECTFILL(a6)
  303.  
  304.              move.l   #0,d0            ; Calculate new Gadnr
  305.              move.l   #0,d1
  306.              move.b   Gadnr,d0
  307.              lsl.b    #2,d0            ; d0=(Gadnr)*4+
  308.              move.b   (sp)+,d1
  309.              beq      2$
  310.              bpl      Draw
  311.              add.b    #1,d0
  312.              bra      Draw
  313. 2$           add      #2,d0
  314.              move.b   (sp)+,d1
  315.              bpl      Draw
  316.              add.b    #1,d0
  317.  
  318. Draw:        lea      GadDirTab,a0
  319.              add.l    d0,a0
  320.              move.b   (a0),Gadnr       ; Gadnr=(a0+d0)
  321.              bsr      GetXY            ; Fetch new X/Y
  322.              move.l   Intbase,a6       ; DrawImage(Gadnr,Arrow)
  323.              move.l   Rastport,a0
  324.              lea      ArrowIStr,a1
  325.              jsr      DRAWIMAGE(a6)
  326.              bra      WaitLoop
  327.  
  328. *------------------------------------------------
  329. *--              local sub-routines            --
  330. *------------------------------------------------
  331. * -----------  Prefs-Werte -> Screen  -----------
  332. PutVal2Scr:  bsr      GetXY           ; Gadnr -> (X/Y)
  333.              move.l   Intbase,a6      ; And now we bring all the prefs
  334.              move.l   Rastport,a0     ; to the screen
  335.              lea      PrefsTab,a1     ; (don't ask me how this works,
  336.              move.l   #0,d2        ; Thank God THAT it works)
  337.              move.b   Gadnr,d2
  338.              cmp.b    #3,d2          ; 0 - 3
  339.              bgt      1$
  340.              add.w    #110,d0
  341.              btst.b   d2,(a1)
  342.              bra      2$
  343. 1$           add.w    #165,d0
  344.              cmp.b    #8,d2          ; 4 - 8
  345.              bgt      5$
  346.              sub.b    #4,d2
  347.              btst.b   d2,1(a1)
  348. 2$           beq      3$
  349.              lea      LEDonIStr,a1
  350.              bra      4$
  351. 3$           lea      LEDoffIStr,a1
  352. 4$           jsr      DRAWIMAGE(a6)
  353.              rts
  354. 5$           move.w   d0,-(sp)      ; 9 - 12  (save x-&y-offset)
  355.              move.w   d1,-(sp)
  356.              lea      BackgrIStr,a1
  357.              jsr      DRAWIMAGE(a6) ; DrawImage(Backgr. for number-display)
  358.              move.l   Gfxbase,a6
  359.              move.l   Rastport,a1
  360.              move.w   (sp)+,d1
  361.              add.w    #8,d1
  362.              move.w   (sp)+,d0
  363.              jsr      MOVE(a6)     ; Move(d0,d1)
  364.              move.l   Rastport,a1
  365.              move.l   #13,d0
  366.              jsr      SETAPEN(a6)  ; SetAPen(13)
  367.              move.l   Rastport,a1
  368.              move.l   #0,d0
  369.              jsr      SETSOFTSTYLE(a6)
  370.              move.l   #0,d0        ; get the decimal string
  371.              lea      PrefsTab,a1
  372.              move.b   -7(a1,d2.l),d0
  373.              lea      DecTxt,a0
  374.              bsr      ToDec
  375.              sub.w    #2,a0
  376.              move.l   Rastport,a1
  377.              move.l   #2,d0
  378.              jsr      TEXT(a6)     ; Text(decstring,2)
  379.              rts
  380. * -----------  Write Text on Gadgets  -----------
  381. ; a3=Txtptr   d3=delta-y   d2=delta-x   d0=colour
  382. GTxt:        move.l   Rastport,a1
  383.              jsr      SETAPEN(a6)
  384.              move.l   Rastport,a1
  385.              bsr      GetXY
  386.              add.w    d2,d0
  387.              add.w    d3,d1
  388.              jsr      MOVE(a6)
  389.              move.l   Rastport,a1
  390.              move.l   #11,d0
  391.              move.l   a3,a0
  392.              jsr      TEXT(a6)
  393.              add.w    #11,a3
  394.              rts
  395. * -----------  Gadnr -> Cursor-(x/y) ------------
  396. GetXY:       move.l   #0,d0
  397.              move.b   Gadnr,d0
  398.              add.b    d0,d0         ; (Gadnr)*2 +
  399.              lea      GadXYTab,a0   ; GadXYTab
  400.              add.l    d0,a0         ; =a0
  401.              move.b   (a0),d0
  402.              add.w    d0,d0         ; width  = d0 = (a0)*2
  403.              move.w   #0,d1
  404.              move.b   1(a0),d1      ; height = d0 = 1(a0)
  405.              rts
  406.  
  407.  
  408. * ------------------------------------------------------------------
  409. * --                      The real Game                           --
  410. * ------------------------------------------------------------------
  411. Game:        bsr      OpenScreen
  412.              lea      Score,a0
  413.              bsr      Sort         ; Sort the scores
  414.  
  415.              move.l   #0,d0        ; set round no.
  416.              move.b   Round,d0
  417.              lea      DecTxt,a0
  418.              bsr      ToDec
  419.              move.b   #32,-4(a0)
  420.              lea      ScoreScr,a1
  421.              move.l   -4(a0),90(a1)
  422.  
  423.              move.l   Gfxbase,a6
  424.              lea      ScoreScr,a5
  425.              move.l   #6,d7
  426. 1$:          move.l   Rastport,a1  ; The 3D-frames consits of
  427.              move.w   (a5)+,d0     ; rectangles whose coordinates
  428.              jsr      SETAPEN(a6)  ; can be found under "ScoreScr:"
  429.              move.l   Rastport,a1
  430.              move.w   (a5)+,d0
  431.              move.w   (a5)+,d1
  432.              move.w   (a5)+,d2
  433.              move.w   (a5)+,d3
  434.              jsr      RECTFILL(a6)
  435.              dbf      d7,1$
  436.  
  437.              move.l   #3,d7
  438. 2$:          move.l   Rastport,a1  ; some text
  439.              move.w   (a5)+,d0
  440.              jsr      SETAPEN(a6)
  441.              move.l   Rastport,a1
  442.              move.w   (a5)+,d0
  443.              move.w   (a5)+,d1
  444.              jsr      MOVE(a6)
  445.              move.l   Rastport,a1
  446.              move.w   (a5)+,d0
  447.              move.l   a5,a0
  448.              add.w    d0,a5
  449.              jsr      TEXT(a6)
  450.              dbf      d7,2$
  451.  
  452.              lea      SortNr,a2
  453.              lea      GadTxtTab,a3 ; this loop writes the scores
  454.              move.l   #88,d3
  455.              move.l   #0,d2
  456.              move.l   #3,d7
  457. 3$:          move.w   (a2)+,d2
  458.              move.l   #0,d0
  459.              move.b   d2,d0
  460.              add.b    d2,d0
  461.              add.b    d2,d0
  462.              add.b    d0,d0
  463.              lea      0(a3,d0.w),a5
  464.              move.l   Rastport,a1
  465.              move.b   (a5)+,d0
  466.              jsr      SETAPEN(a6)  ; Set the accurate colour
  467.              move.l   Rastport,a1
  468.              move.l   #96,d0
  469.              add.l    #9,d3
  470.              move.l   d3,d1
  471.              jsr      MOVE(a6)     ; Everythging must be in rank & file
  472.              lea      PlayerTxt,a4
  473.              move.b   #'0'+4,(a4)  ; the player's no. -> PlayerTxt
  474.              sub.b    d7,(a4)
  475.              add.w    #4,a4
  476.              move.l   #10,d1
  477. 4$:          move.b   (a5)+,(a4)+  ; player's name=device -> PlayerTxt
  478.              dbf      d1,4$
  479.              lea      13(a4),a0
  480.              lea      Bonus,a5
  481.              move.l   #0,d0
  482.              move.w   0(a5,d2.w),d0
  483.              bsr      ToDec        ; Bonus -> PlayerTxt
  484.              lea      23(a4),a0
  485.              lea      Score,a5
  486.              move.l   #0,d0
  487.              move.w   0(a5,d2.w),d0
  488.              bsr      ToDec        ; Score -> PlayerTxt
  489.              lsr.w    #1,d2
  490.              lea      34(a4),a0
  491.              lea      Victory,a5
  492.              move.l   #0,d0
  493.              move.b   0(a5,d2.w),d0
  494.              bsr      ToDec        ; Victories -> PlayerTxt
  495.              move.l   Rastport,a1
  496.              lea      PlayerTxt,a0
  497.              move.l   #54,d0
  498.              jsr      TEXT(a6)     ; Write PlayerTxt
  499.              dbf      d7,3$
  500.              move.b   PrefsTab,SavPMask ; initialize SavPMask
  501. SWaitLoop:   DELSEC   #6                ; Wait
  502.              bsr      Ask               ; (I know this is bad style,
  503.              tst.b    d3                ; but have YOU ever tried to
  504.              bne      BuildScr          ; programme devices?)
  505.              cmp.b    #ESC,CIA_KEY
  506.              bne      SWaitLoop
  507.              jsr      CloseScr
  508.              bra      MainMenu
  509.  
  510. BuildScr:    jsr      CloseScr          ; Close prevous Screen
  511.              lea      GameScrStr,a0     ; and open the game screen
  512.              lea      PrefsTab,a5
  513.              move.w   #0,12(a0)
  514.              move.w   #WIDTH,4(a0) ; WIDTH
  515.              btst.b   #3,1(a5)     ; Hires ?
  516.              beq      1$
  517.              lsl.w    4(a0)
  518.              bset.b   #7,12(a0)    ; = bset.w #15,12(a0) = Viewmodes
  519. 1$:          move.w   #HGTNTSC,6(a0) ; HEIGHT
  520.              btst.b   #1,1(a5)       ; PAL/NTSC ?
  521.              beq      2$
  522.              move.w   #HGTPAL,6(a0)
  523. 2$:          btst.b   #4,1(a5)       ; Interlace ?
  524.              beq      3$
  525.              lsl.w    6(a0)
  526.              bset.b   #2,13(a0)    ; = bset.w #02,12(a0) = Viewmodes
  527. 3$:          jsr      OPENSCREEN(a6)
  528.              move.l   d0,Screen
  529.              beq      Game
  530.              add.l    #44,d0
  531.              move.l   d0,Viewport
  532.              add.l    #40,d0
  533.              move.l   d0,Rastport
  534.              move.l   Gfxbase,a6
  535.              move.l   Rastport,a1
  536.              jsr      CLEARSCREEN(a6)
  537.              move.l   Viewport,a0
  538.              lea      GameColTab,a1
  539.              move.l   #8,d0
  540.              jsr      LOADRGB4(a6)
  541.  
  542.              move.l   Rastport,a1
  543.              move.w   #5,d0
  544.              jsr      SETAPEN(a6)
  545.              lea      GameScrStr,a4
  546.              move.w   4(a4),d5
  547.              move.w   6(a4),d6      ; How many stars?
  548.              move.w   d5,d7
  549.              mulu.w   d6,d7
  550.              lsr.l    #8,d7
  551.              lsr.l    #6,d7
  552.              move.l   #0,d0
  553.              move.b   4(a5),d0
  554.              mulu.w   d0,d7
  555.              beq      Boxes
  556. StarsLoop:   move.l   Rastport,a1   ; draw them
  557.              move.w   d6,d0
  558.              bsr      Rnd
  559.              move.w   d0,d1
  560.              move.w   d5,d0
  561.              bsr      Rnd
  562.              jsr      WRITEPIXEL(a6)
  563.              dbf      d7,StarsLoop
  564.  
  565. Boxes:       move.l   Intbase,a6
  566.              sub.w    #8,d5
  567.              sub.w    #8,d6
  568.              move.l   #0,d7         ; How many boxes?
  569.              move.b   3(a5),d7
  570.              beq      SavPod
  571. BoxLoop:     move.l   Rastport,a0   ; draw them
  572.              lea      BoxIStr,a1
  573.              move.w   d6,d0
  574.              bsr      Rnd
  575.              and.b    #%11111000,d0 ; this prevents the boxes
  576.              move.w   d0,d1         ; from overlaying
  577.              move.w   d5,d0
  578.              bsr      Rnd
  579.              and.b    #%11111000,d0
  580.              jsr      DRAWIMAGE(a6)
  581.              dbf      d7,BoxLoop
  582.  
  583. SavPod:      move.l   #0,d7
  584.              move.b   5(a5),d7      ; Draw the Savety Pods
  585.              beq      CyclSect
  586. PodLoop:     move.l   Rastport,a0
  587.              lea      PodIStr,a1
  588.              move.w   d6,d0
  589.              bsr      Rnd
  590.              and.b    #%11111000,d0
  591.              move.w   d0,d1
  592.              move.w   d5,d0
  593.              bsr      Rnd
  594.              and.b    #%11111000,d0
  595.              jsr      DRAWIMAGE(a6)
  596.              dbf      d7,PodLoop
  597.  
  598. CyclSect:    add.w    #7,d5          ; every cycle gets some blank
  599.              add.w    #7,d6          ; space around his starting
  600.              move.l   Gfxbase,a6     ; point.
  601.              move.l   Rastport,a1
  602.              move.l   #0,d0
  603.              jsr      SETAPEN(a6)
  604.              lea      CyclSecTab,a4
  605.              move.w   d5,d0
  606.              sub.w    #8,d0
  607.              move.w   d0,4(a4)
  608.              move.w   d0,20(a4)
  609.              sub.w    #24,d0
  610.              move.w   d0,(a4)
  611.              move.w   d0,16(a4)
  612.              move.w   d6,d0
  613.              sub.w    #8,d0
  614.              move.w   d0,6(a4)
  615.              move.w   d0,14(a4)
  616.              sub.w    #24,d0
  617.              move.w   d0,2(a4)
  618.              move.w   d0,10(a4)
  619.              move.l   #3,d7
  620. 1$:          move.l   Rastport,a1
  621.              move.w   (a4)+,d0
  622.              move.w   (a4)+,d1
  623.              move.w   (a4)+,d2
  624.              move.w   (a4)+,d3
  625.              btst.b   d7,(a5)
  626.              beq      2$
  627.              jsr      RECTFILL(a6)
  628. 2$:          dbf      d7,1$
  629.              add.w    #1,d5
  630.              add.w    #1,d6
  631.  
  632. PlayLoop:    lea      XY,a0       ; init. x,y,vx,vy of cycles
  633.              lea      XYInit,a1
  634.              move.w   d5,d0
  635.              sub.w    #16,d0
  636.              move.w   d0,(a1)
  637.              move.w   d0,16(a1)
  638.              move.w   d6,d0
  639.              sub.w    #16,d0
  640.              move.w   d0,2(a1)
  641.              move.w   d0,10(a1)
  642.              move.l   #7,d7
  643. 1$:          move.l   (a1)+,(a0)+
  644.              dbf      d7,1$
  645.  
  646.              DELSEC   #50          ; Countdown
  647.              move.l   Intbase,a6
  648.              sub.l    a0,a0
  649.              jsr      DISPLAYBEEP(a6)
  650.  
  651.              lea      Bonus,a3   ; delete Bonus (=points/round)
  652.              clr.l    (a3)
  653.              clr.l    4(a3)
  654.              clr.b    cAnz
  655.              move.b   (a5),PlayerMask   ; who's playing?
  656.              move.w   #255*8+1,Points
  657.  
  658. GLoop1:      sub.w    #1,Points
  659.              bpl      1$
  660.              move.w   #255*8,Points
  661. 1$:          move.w   #3,d7
  662.              move.l   Gfxbase,a6
  663.              lea      XY,a2
  664.  
  665. GLoop2:      btst.b   d7,PlayerMask ; Does No. d7 play ?
  666.              beq      1$
  667.              bsr      Ask
  668.              btst.b   d7,d0         ; input from no. d7
  669.              beq      2$
  670.              move.w   d1,d0
  671.              add.w    d2,d0
  672.              beq      204$     ; d1=d2=0? -> Firecheck
  673.              move.w   d1,d0
  674.              add.w    4(a2),d0      ; this prevents the cycles from
  675.              beq      202$          ; having a "backwards crash"
  676.              move.w   d1,4(a2)
  677. 202$:        move.w   d2,d0
  678.              add.w    6(a2),d0
  679.              beq      204$
  680.              move.w   d2,6(a2)
  681. 204$:        tst.b    d3        ; Fire
  682.              beq      2$
  683.              move.l   #JMPMAX,d0
  684.              bsr      Rnd
  685.              add.w    #1,d0
  686.              move.w   d0,d3      ;d0=d3=random number
  687.              muls.w   4(a2),d3
  688.              add.w    d3,(a2)    ; X = X + dX*Rnd(JMPMAX)
  689.              muls.w   6(a2),d0
  690.              add.w    d0,2(a2)   ; Y = Y + dY*Rnd(JMPMAX)
  691. 2$:          move.w   4(a2),d1
  692.              add.w    d1,(a2)
  693.              move.w   6(a2),d2
  694.              add.w    d2,2(a2)
  695.  
  696.              cmp.w    #0,(a2)    ; cycle touches border ?
  697.              bge      13$        ; no -> next border check
  698.              btst.b   #0,1(a5)   ; yes -> crash ?
  699.              beq      11$        ;        yes -> go to crash routine
  700.              add.w    d5,(a2)    ;        no  -> other side
  701. 13$:         cmp.w    #0,2(a2)
  702.              bge      14$
  703.              btst.b   #0,1(a5)
  704.              beq      11$
  705.              add.w    d6,2(a2)
  706. 14$:         cmp.w    (a2),d5
  707.              bgt      15$
  708.              btst.b   #0,1(a5)
  709.              beq      11$
  710.              sub.w    d5,(a2)
  711. 15$:         cmp.w    2(a2),d6
  712.              bgt      16$
  713.              btst.b   #0,1(a5)
  714.              beq      11$
  715.              sub.w    d6,2(a2)
  716.  
  717. 16$:         move.l   Rastport,a1
  718.              move.w   d7,d0
  719.              add.w    #1,d0
  720.              jsr      SETAPEN(a6) ; SetAPen(d7+1)
  721.              move.l   Rastport,a1
  722.              move.w   (a2),d0
  723.              move.w   2(a2),d1
  724.              jsr      READPIXEL(a6) ; ReadPixel((a2),2(a2))
  725.              cmp.l    #7,d0         ; Savety Pod-colour?
  726.              beq      10$
  727.              tst.l    d0
  728.              bne      11$           ; colour <>0 -> Crash
  729.              move.l   Rastport,a1
  730.              move.w   (a2),d0
  731.              move.w   2(a2),d1
  732.              jsr      WRITEPIXEL(a6) ; write trace
  733. 1$:          add.w    #8,a2
  734.              dbf      d7,GLoop2
  735.  
  736.              cmp.b    #ESC,CIA_KEY   ; ESC ?
  737.              bne      5$
  738.              jsr      CloseScr       ; -> back to SCORE-Screen
  739.              bra      Game
  740. 5$:          cmp.b    #CTRL,CIA_KEY  ; CTRL ?
  741.              bne      6$             ; -> CLEARSCREEN
  742.              move.l   Rastport,a1
  743.              move.l   #0,d0
  744.              move.l   #0,d1
  745.              jsr      MOVE(a6)
  746.              move.l   Rastport,a1
  747.              jsr      CLEARSCREEN(a6)
  748. 6$:          cmp.b    #HELP,CIA_KEY  ; HELP ?
  749.              bne      7$
  750.              bsr      Wait           ; -> Wait
  751. 7$:          move.l   #DELMAX,d1     ; speed means delay
  752.              sub.b    2(a5),d1
  753.              DELSEC   d1
  754.              bra      GLoop1
  755.  
  756. 10$:         btst.b   d7,SavPMask ; Savety Pod
  757.              beq      11$
  758.              bclr.b   d7,SavPMask
  759.              move.l   d7,-(sp)
  760.              move.w   d6,d7
  761.              sub.w    #1,d7
  762. 103$:        move.l   Gfxbase,a6   ; animation
  763.              move.l   Rastport,a1
  764.              move.w   (a2),d0
  765.              move.w   2(a2),d1
  766.              jsr      MOVE(a6)
  767.              move.l   Rastport,a1
  768.              move.w   d5,d0
  769.              sub.w    #1,d0
  770.              move.w   d6,d1
  771.              sub.w    #1,d1
  772.              sub.w    d7,d1
  773.              jsr      DRAW(a6)
  774.              dbf      d7,103$
  775.              move.w   d5,d7
  776.              sub.w    #1,d7
  777. 102$:        move.l   Gfxbase,a6
  778.              move.l   Rastport,a1
  779.              move.w   (a2),d0
  780.              move.w   2(a2),d1
  781.              jsr      MOVE(a6)
  782.              move.l   Rastport,a1
  783.              move.w   d7,d0
  784.              move.w   d6,d1
  785.              sub.w    #1,d1
  786.              jsr      DRAW(a6)
  787.              dbf      d7,102$
  788.              move.w   d6,d7
  789.              sub.w    #1,d7
  790. 101$:        move.l   Gfxbase,a6
  791.              move.l   Rastport,a1
  792.              move.w   (a2),d0
  793.              move.w   2(a2),d1
  794.              jsr      MOVE(a6)
  795.              move.l   Rastport,a1
  796.              clr.w    d0
  797.              move.w   d7,d1
  798.              jsr      DRAW(a6)
  799.              dbf      d7,101$
  800.              move.w   d5,d7
  801.              sub.w    #1,d7
  802. 104$:        move.l   Gfxbase,a6
  803.              move.l   Rastport,a1
  804.              move.w   (a2),d0
  805.              move.w   2(a2),d1
  806.              jsr      MOVE(a6)
  807.              move.l   Rastport,a1
  808.              move.w   d5,d0
  809.              sub.w    #1,d0
  810.              sub.w    d7,d0
  811.              clr.w    d1
  812.              jsr      DRAW(a6)
  813.              dbf      d7,104$
  814.              move.l   Gfxbase,a6     ; Write "Player x hit the s.pod"
  815.              move.l   (sp)+,d7
  816.              move.l   Rastport,a1
  817.              move.l   #1,d0
  818.              add.w    d7,d0
  819.              jsr      SETBPEN(a6)
  820.              move.l   Rastport,a1
  821.              move.l   #3,d0
  822.              add.w    d7,d0
  823.              jsr      SETAPEN(a6)
  824.              move.l   Rastport,a1
  825.              move.w   d5,d0
  826.              lsr.w    #1,d0
  827.              sub.w    #29*8/2,d0
  828.              move.w   d6,d1
  829.              lsr.w    #1,d1
  830.              jsr      MOVE(a6)
  831.              move.l   Rastport,a1
  832.              lea      SavPodTxt,a0
  833.              add.b    d7,7(a0)
  834.              move.l   #29,d0
  835.              jsr      TEXT(a6)
  836.              bsr      Wait
  837.              bra      BuildScr
  838.  
  839.  
  840. 11$:         btst.b   #2,1(a5)  ; Crash
  841.              beq      115$      ; Explosion ?
  842.              move.l   #14,d3
  843. 111$         move.l   Gfxbase,a6
  844.              move.l   Rastport,a1
  845.              move.w   d3,d0
  846.              add.w    #1,d0
  847.              jsr      SETAPEN(a6)
  848.              move.l   Rastport,a1
  849.              move.w   (a2),d0
  850.              move.w   2(a2),d1
  851.              move.l   #15,d2
  852.              sub.w    d3,d2
  853.              move.w   d3,-(sp)
  854.              move.w   d2,d3
  855.              jsr      DRAWELLIPSE(a6) ; Draw explosion
  856.              move.w   (sp)+,d3
  857.              DELSEC   #5
  858.              dbf      d3,111$
  859.              move.l   Gfxbase,a6
  860.              lea      XY,a4
  861.              move.l   #3,d7          ; check all cycles
  862. 112$         btst.b   d7,PlayerMask
  863.              beq      113$
  864.              move.l   Rastport,a1
  865.              move.w   (a4),d0
  866.              add.w    4(a4),d0
  867.              move.w   2(a4),d1
  868.              add.w    6(a4),d1
  869.              jsr      READPIXEL(a6)
  870.              tst.l    d0
  871.              beq      113$
  872.              bclr.b   d7,PlayerMask
  873.              add.b    #1,cAnz
  874.              bsr      TraceFlicker
  875. 113$         add.w    #8,a4
  876.              dbf      d7,112$
  877.              move.l   Rastport,a1
  878.              move.l   #0,d0
  879.              jsr      SETAPEN(a6)
  880.              move.l   #15,d3         ; fire's over
  881. 114$         move.l   Gfxbase,a6
  882.              move.l   Rastport,a1
  883.              move.w   (a2),d0
  884.              move.w   2(a2),d1
  885.              move.w   d3,d2
  886.              move.w   d3,-(sp)
  887.              jsr      DRAWELLIPSE(a6)
  888.              move.w   (sp)+,d3
  889.              DELSEC   #5
  890.              dbf      d3,114$
  891.              bra      116$
  892.  
  893. 115$         bclr.b   d7,PlayerMask  ; no explosion
  894.              bsr      TraceFlicker
  895.              add.b    #1,cAnz
  896.  
  897. 116$         lea      Bonus,a4
  898.              lea      6(a4),a4
  899.              clr.b    d0
  900.              move.l   #3,d3
  901. 117$         btst.b   d3,PlayerMask
  902.              beq      118$
  903.              add.b    #1,d0
  904.              move.w   Points,d1      ; add Points
  905.              add.w    d1,(a4)
  906. 118$         sub.w    #2,a4
  907.              dbf      d3,117$
  908.              move.w   #255*8,Points  ; initialize Points
  909.              cmp.b    #2,d0          ; 2 cycles left?
  910.              blt      EndOfRound     ; no! fewer -> End of this Round
  911.              bra      GLoop1         ; >=2 -> continue race
  912.  
  913.  
  914. EndOfRound:  lea      Victory,a0
  915.              lea      Bonus,a1
  916.              lea      Score,a2
  917.              clr.w    d0
  918.              move.b   cAnz,d0
  919.              move.l   #3,d7
  920. 1$:          move.l   #0,d1         ; calculate Bonus, Scores
  921.              move.w   (a1),d1       ; Victories
  922.              lsr.w    #3,d1
  923.              divs.w   d0,d1
  924.              move.w   d1,(a1)+
  925.              add.w    d1,(a2)+
  926.              btst.b   d7,PlayerMask
  927.              beq      2$
  928.              add.b    #1,0(a0,d7.w)
  929. 2$:          dbf      d7,1$
  930.              bsr      Wait
  931.              jsr      CloseScr
  932.              add.b    #1,Round
  933.              bra      Game
  934. *------------------------------------------------
  935. *--             local sub-routines             --
  936. *------------------------------------------------
  937. * --------------- wait for input ----------------
  938. Wait:        DELSEC   #6           ; a wait routine
  939.              bsr      Ask
  940.              cmp.b    #1,d3
  941.              bne      Wait
  942.              rts
  943. * --------------- let trace flicker -------------
  944. TraceFlicker: move.l  d3,-(sp)     ; cycle a cycle's colour (a pun!)
  945.               move.l  #10,d4       ; after crashing
  946. 1$:           DELSEC  #3
  947.               move.l  Gfxbase,a6
  948.               move.l  Viewport,a0
  949.               move.w  d7,d0
  950.               add.w   #1,d0
  951.               move.l  #7,d1
  952.               move.w  d1,d2
  953.               move.w  d1,d3
  954.               jsr     SETRGB4(a6)
  955.               DELSEC  #3
  956.               move.l  Gfxbase,a6
  957.               move.l  Viewport,a0
  958.               lea     GameColTab,a1
  959.               move.l  #5,d0
  960.               jsr     LOADRGB4(a6)
  961.               dbf     d4,1$
  962.               move.l  (sp)+,d3
  963.               rts
  964. * ------------------ sort scores ----------------
  965. * a0->ptr to scores
  966. Sort:        move.l   #0,d1        ; sort scores
  967.              move.l   #0,d2
  968. 1$:          lea      SortNr,a1
  969.              move.l   #2,d4
  970.              move.l   #0,d0
  971. 2$:          move.w   (a1),d1
  972.              move.w   0(a0,d1.w),d2
  973.              move.w   2(a1),d1
  974.              move.w   0(a0,d1.w),d3
  975.              cmp.w    d2,d3
  976.              ble      3$
  977.              move.l   #1,d0
  978.              move.w   (a1),2(a1)
  979.              move.w   d1,(a1)
  980. 3$:          add.w    #2,a1
  981.              dbf      d4,2$
  982.              tst.b    d0
  983.              bne      1$
  984.              rts
  985. * ----- compute random number [0 to d0-1] ------
  986. * d0->Range
  987. Rnd:         add.w    $DFF006,d3   ; I worked on that for about
  988.              lea      EXECBASE,a3  ; 2 weeks !!
  989.              add.w    $11e(a3),d3
  990.              add.w    d3,d3
  991.              eor.w    #$1D872B41,d3
  992.              mulu.w   d3,d0
  993.              clr.w    d0
  994.              swap.w   d0
  995.              bclr.l   #15,d0
  996.              rts
  997.  
  998.  
  999. * ------------------------------------------------------------------
  1000. * --                       Quit Routines                          --
  1001. * ------------------------------------------------------------------
  1002. CloseRaw:    move.l   Dosbase,a6
  1003.              move.l   Rawhandle,d1
  1004.              jsr      CLOSE(a6)
  1005. CloseLibs:   move.l   EXECBASE,a6
  1006. CloseGfx:    CLOSELIB Gfxbase
  1007. CloseInt:    CLOSELIB Intbase
  1008. CloseDos:    CLOSELIB Dosbase
  1009. ClosePrg:
  1010.              move.l   SPbackup,sp
  1011.              move.l   WBmsg,d1
  1012.              beq      Exit         ; WBmsg=0 -> started from CLI
  1013.              move.l   d1,a1
  1014.              jsr      REPLYMSG(a6)
  1015. Exit:        move.l   #0,d0
  1016.              rts
  1017.  
  1018.  
  1019. * ------------------------------------------------------------------
  1020. * --                    global sub-routrine                       --
  1021. * ------------------------------------------------------------------
  1022. * -------------  d0 -> decimal string  ----------
  1023. * a0=ptr to txt d0.l=number
  1024. ToDec:       move.l   #4,d1
  1025.              lea      DecTab,a1
  1026. DLoop:       divu     (a1)+,d0
  1027.              add.b    #'0',d0
  1028.              move.b   d0,(a0)+
  1029.              clr.w    d0
  1030.              swap     d0
  1031.              dbf      d1,DLoop
  1032.              rts
  1033. * --------------- Check the Input ---------------
  1034. Ask:         move.l   #0,d0 ; nix=0 Joy1=1 Joy2=2 Keyb=4 Nump=8
  1035.              move.l   #0,d1 ; <- ->
  1036.              move.l   #0,d2 ; /\  \/
  1037.              move.l   #0,d3 ; Fire
  1038.              move.b   CIA_KEY,d4
  1039.              cmp.b    #D,d4
  1040.              bne      Kleft
  1041.              move.b   #1,d1
  1042.              move.b   #4,d0
  1043.              rts
  1044. Kleft:       cmp.b    #S,d4
  1045.              bne      Kdown
  1046.              move.l   #-1,d1
  1047.              move.l   #4,d0
  1048.              rts
  1049. Kdown:       cmp.b    #X,d4
  1050.              bne      Kup
  1051.              move.l   #1,d2
  1052.              move.l   #4,d0
  1053.              rts
  1054. Kup:         cmp.b    #E,d4
  1055.              bne      Kfire
  1056.              move.l   #-1,d2
  1057.              move.l   #4,d0
  1058.              rts
  1059. Kfire:       cmp.b    #SPACE,d4
  1060.              bne      Nright
  1061.              move.l   #1,d3
  1062.              move.l   #4,d0
  1063.              rts
  1064. Nright:      cmp.b    #N6,d4
  1065.              bne      Nleft
  1066.              move.l   #1,d1
  1067.              move.l   #8,d0
  1068.              rts
  1069. Nleft:       cmp.b    #N4,d4
  1070.              bne      Ndown
  1071.              move.l   #-1,d1
  1072.              move.l   #8,d0
  1073.              rts
  1074. Ndown:       cmp.b    #N2,d4
  1075.              bne      Nup
  1076.              move.l   #1,d2
  1077.              move.l   #8,d0
  1078.              rts
  1079. Nup:         cmp.b    #N8,d4
  1080.              bne      Nfire
  1081.              move.l   #-1,d2
  1082.              move.l   #8,d0
  1083.              rts
  1084. Nfire:       cmp.b    #ENTER,d4
  1085.              bne      Joy2Dir
  1086.              move.l   #1,d3
  1087.              move.l   #8,d0
  1088.              rts
  1089. Joy2Dir:     move.w   CIA_JOY2D,d4
  1090.              btst.l   #1,d4
  1091.              beq      J2left
  1092.              move.l   #1,d1
  1093.              move.l   #2,d0
  1094.              rts
  1095. J2left:      btst.l   #9,d4
  1096.              beq      J2down
  1097.              move.l   #-1,d1
  1098.              move.l   #2,d0
  1099.              rts
  1100. J2down:      move.w   d4,d2
  1101.              lsr.w    #1,d2
  1102.              eor.w    d4,d2
  1103.              btst.l   #0,d2
  1104.              beq      J2up
  1105.              move.l   #1,d2
  1106.              move.l   #2,d0
  1107.              rts
  1108. J2up:        btst.l   #8,d2
  1109.              beq      Joy1Dir
  1110.              move.l   #-1,d2
  1111.              move.l   #2,d0
  1112.              rts
  1113. Joy1Dir:     move.w   CIA_JOY1D,d4
  1114.              move.l   #0,d2
  1115.              btst.l   #1,d4
  1116.              beq      J1left
  1117.              move.l   #1,d1
  1118.              move.l   #1,d0
  1119.              rts
  1120. J1left:      btst.l   #9,d4
  1121.              beq      J1down
  1122.              move.l   #-1,d1
  1123.              move.l   #1,d0
  1124.              rts
  1125. J1down:      move.w   d4,d2
  1126.              lsr.w    #1,d2
  1127.              eor.w    d4,d2
  1128.              btst.l   #0,d2
  1129.              beq      J1up
  1130.              move.l   #1,d2
  1131.              move.l   #1,d0
  1132.              rts
  1133. J1up:        btst.l   #8,d2
  1134.              beq      J2Fire
  1135.              move.l   #-1,d2
  1136.              move.l   #1,d0
  1137.              rts
  1138. J2Fire:      move.b   CIA_JFIRE,d4
  1139.              move.l   #0,d2
  1140.              btst.l   #7,d4
  1141.              bne      J1Fire
  1142.              move.l   #1,d3
  1143.              move.l   #2,d0
  1144.              rts
  1145. J1Fire:      btst.l   #6,d4
  1146.              bne      Nomove
  1147.              move.l   #1,d3
  1148.              move.l   #1,d0
  1149. Nomove:      rts
  1150. * -----------------  Close Screen ---------------
  1151. * closes a screen / removes coperlist
  1152. CloseScr:    move.l   Gfxbase,a6
  1153.              move.l   Viewport,a0
  1154.              jsr      FREEVPORTCOPLISTS(a6)
  1155.              move.l   Intbase,a6
  1156.              move.l   Screen,a0
  1157.              jsr      CLOSESCREEN(a6)
  1158.              rts
  1159.  
  1160. * -----------------  Open Screen  ---------------
  1161. * opens 640x200x4-screen
  1162. OpenScreen:  move.l   Intbase,a6
  1163.              lea      MenScrStr,a0
  1164.              jsr      OPENSCREEN(a6)
  1165.              move.l   d0,Screen
  1166.              beq      CloseRaw
  1167.              add.l    #44,d0
  1168.              move.l   d0,Viewport
  1169.              add.l    #40,d0
  1170.              move.l   d0,Rastport
  1171. * Set Copper -----------------
  1172.              move.l   EXECBASE,a6
  1173.              move.l   #16,d0
  1174.              move.l   #$10003,d1
  1175.              jsr      ALLOCMEM(a6)
  1176.              move.l   d0,CopMem
  1177.              beq      PutPic
  1178.  
  1179.              move.l   Gfxbase,a6       ; set colours 0 and 2-15 via gfx...
  1180.              move.l   Viewport,a0
  1181.              lea      ColourTab,a1
  1182.              move.l   #16,d0
  1183.              jsr      LOADRGB4(a6)
  1184.  
  1185.              move.l   Rastport,a1      ; (ok, this command doesn't belong to
  1186.              move.l   #0,d0            ; the whole copper thing, but it
  1187.              jsr      SETDRMD(a6)      ; saves a Gfxbase-move!)
  1188.              move.l   CopMem,a0        ; ...and no. 1 becomes a rainbow
  1189.              move.l   #401,d0
  1190.              jsr      UCOPPERLISTINIT(a6)
  1191.  
  1192.              lea.l    CopperTab,a4
  1193.              move.l   #199,d3          ; Zeilen = 200   -> d3
  1194. CopLoop:     move.l   CopMem,a1
  1195.              move.w   #199,d0
  1196.              sub.w    d3,d0
  1197.              move.l   #0,d1
  1198.              jsr      CWAIT(a6)
  1199.              move.l   CopMem,a1
  1200.              jsr      CBUMP(a6)        ; CWait(CopMem,199-d3,0)
  1201.              move.l   CopMem,a1
  1202.              move.l   #$182,d0
  1203.              move.w   (a4)+,d1
  1204.              jsr      CMOVE(a6)
  1205.              move.l   CopMem,a1
  1206.              jsr      CBUMP(a6)        ; CMove(CopMem,Color00,(CopperTab)+)
  1207.              tst.w    (a4)             ; No Entry in ColCopTable?
  1208.              bne      Jump
  1209.              lea      CopperTab,a4     ; from the beginning
  1210. Jump:        dbra     d3,CopLoop
  1211.  
  1212.              move.l   CopMem,a1
  1213.              move.l   #10000,d0
  1214.              move.l   #255,d1
  1215.              jsr      CWAIT(a6)
  1216.              move.l   CopMem,a1
  1217.              jsr      CBUMP(a6)        ; CEND
  1218.              move.l   Intbase,a6
  1219.              move.l   Viewport,a5
  1220.              move.l   CopMem,20(a5)    ; ViewPort.UCopIns=CoppLstPtr
  1221.              jsr      RETHINKDISPLAY(a6)
  1222. * Put Title Picture -----------
  1223. PutPic:      move.l   Intbase,a6
  1224.              move.l   Rastport,a0
  1225.              lea      TitleIStr,a1
  1226.              clr.w    d0
  1227.              clr.w    d1
  1228.              jsr      DRAWIMAGE(a6)
  1229.              rts
  1230.  
  1231.  
  1232.              SECTION  VARS,BSS
  1233.              even
  1234. Dosbase:     ds.l     1  ; all the lib-bases
  1235. Gfxbase:     ds.l     1
  1236. Intbase:     ds.l     1
  1237. Rawhandle:   ds.l     1  ; the RAW:-ptr
  1238. Screen:      ds.l     1  ; the screenptr
  1239. Rastport:    ds.l     1
  1240. Viewport:    ds.l     1
  1241. WBmsg:       ds.l     1  ; ptr -> WBmsg
  1242. BlackTab:    ds.w     16 ; everything's dark
  1243. CopMem:      ds.l     1  ; ptr to Ucopperlist
  1244. SPbackup:    ds.l     1
  1245. Gadnr:       ds.b     1  ; Menu: activated gadgetnr.(0-15)
  1246. DecTxt:      ds.b     5  ; Decimal string for ToDec-routine
  1247. Points:      ds.w     1  ; needed to calculate bonus
  1248. XY:          ds.w     4*4 ; Nr. 4 - 1: X,Y,dX,dY
  1249. Bonus:       ds.w     4
  1250. Score:       ds.w     4
  1251. Victory:     ds.b     4
  1252. Round:       ds.b     1
  1253. PlayerMask:  ds.b     1  ; who's still in the race ?
  1254. SavPMask:    ds.b     1  ; who's allowed to drive into the pod?
  1255. cAnz:        ds.b     1  ; number of crashes
  1256.  
  1257.  
  1258.              SECTION  CONST,DATA
  1259.              even
  1260. XYInit:      dc.w     $FF,$AA,0,-1,16,$AA,0,-1
  1261.              dc.w     $FF,16,0,1,16,16,0,1
  1262. SortNr:      dc.w     0,2,4,6
  1263. Num:         dc.b     '      ',10
  1264.              even
  1265. CyclSecTab:  dc.w     8,8,32,32,8,8,32,32
  1266.              dc.w     8,8,32,32,8,8,32,32
  1267. ScoreScr:    dc.w     8,60,75,580,130
  1268.              dc.w     9,62,76,578,129
  1269.              dc.w     10,64,77,576,128
  1270.              dc.w     8,66,78,574,127
  1271.              dc.w     2,60,155,580,199
  1272.              dc.w     3,62,156,578,198
  1273.              dc.w     4,64,157,576,197
  1274.              dc.w     1,96,85,56
  1275.              dc.b     "Résumé after 000 Rounds:    Bonus     Score    Victories"
  1276.              dc.w     7,104,170,54
  1277.              dc.b     "PRESS  FIRE  TO  CONTINUE   -   ESC  FOR  MAINMENU !!!"
  1278.              dc.w     6,160,179,40
  1279.              dc.b     "During the game press:  <HELP> for pause"
  1280.              dc.w     5,144,188,44
  1281.              dc.b     "<CTRL for cleanning the screen <ESC> to stop"
  1282. PlayerTxt:   dc.b     " . (           )                                      "
  1283. Rawname:     dc.b     "RAW:20/10/200/60/turboMCP",0
  1284. LimitTab:    dc.b     DELMAX,0,99,0,99,0,9,0
  1285. PrefsTab:    dc.b     %1110,%00001,DELMAX-2,0,0,0
  1286.              even
  1287. DecTab:      dc.w     10000,1000,100,10,1 ; powers of 10
  1288. GBoxXYTab:   dc.w     8,0,62,144,62+24
  1289.              dc.w     8,165,62,309,62+24
  1290.              dc.w     8,330,62,474,62+24
  1291.              dc.w     8,495,62,639,62+24
  1292.              dc.w     9,2,63,142,63+22
  1293.              dc.w     9,167,63,307,63+22
  1294.              dc.w     9,332,63,472,63+22
  1295.              dc.w     9,497,63,637,63+22
  1296.              dc.w     10,4,64,140,64+20
  1297.              dc.w     10,169,64,305,64+20
  1298.              dc.w     10,334,64,470,64+20
  1299.              dc.w     10,499,64,635,64+20
  1300.              dc.w     5,0,97,199,97+24
  1301.              dc.w     5,220,97,419,97+24
  1302.              dc.w     5,440,97,639,97+24
  1303.              dc.w     6,2,98,197,98+22
  1304.              dc.w     6,222,98,417,98+22
  1305.              dc.w     6,442,98,637,98+22
  1306.              dc.w     7,4,99,195,99+20
  1307.              dc.w     7,224,99,415,99+20
  1308.              dc.w     7,444,99,635,99+20
  1309.              dc.w     5,0,123,199,123+24
  1310.              dc.w     5,220,123,419,123+24
  1311.              dc.w     5,440,123,639,123+24
  1312.              dc.w     6,2,124,197,124+22
  1313.              dc.w     6,222,124,417,124+22
  1314.              dc.w     6,442,124,637,124+22
  1315.              dc.w     7,4,125,195,125+20
  1316.              dc.w     7,224,125,415,125+20
  1317.              dc.w     7,444,125,635,125+20
  1318.              dc.w     5,0,149,199,149+24
  1319.              dc.w     5,220,149,419,149+24
  1320.              dc.w     5,440,149,639,149+24
  1321.              dc.w     6,2,150,197,150+22
  1322.              dc.w     6,222,150,417,150+22
  1323.              dc.w     6,442,150,637,150+22
  1324.              dc.w     7,4,151,195,151+20
  1325.              dc.w     7,224,151,415,151+20
  1326.              dc.w     7,444,151,635,151+20
  1327.              dc.w     2,0,175,199,175+24
  1328.              dc.w     2,220,175,419,175+24
  1329.              dc.w     2,440,175,639,175+24
  1330.              dc.w     3,2,176,197,176+22
  1331.              dc.w     3,222,176,417,176+22
  1332.              dc.w     3,442,176,637,176+22
  1333.              dc.w     4,4,177,195,177+20
  1334.              dc.w     4,224,177,415,177+20
  1335.              dc.w     4,444,177,635,177+20
  1336. GadDirTab:   dc.b     1,3,4,13    ;0  >,<,\/,/\
  1337.              dc.b     2,0,5,14    ;1
  1338.              dc.b     3,1,5,14    ;2
  1339.              dc.b     0,2,6,15    ;3
  1340.              dc.b     5,6,7,0     ;4
  1341.              dc.b     6,4,8,1     ;5
  1342.              dc.b     4,5,9,3     ;6
  1343.              dc.b     8,9,10,4    ;7
  1344.              dc.b     9,7,11,5    ;8
  1345.              dc.b     7,8,12,6    ;9
  1346.              dc.b     11,12,13,7  ;10
  1347.              dc.b     12,10,14,8  ;11
  1348.              dc.b     10,11,15,9  ;12
  1349.              dc.b     14,15,0,10  ;13
  1350.              dc.b     15,13,2,11  ;14
  1351.              dc.b     13,14,3,12  ;15
  1352. GadXYTab:    dc.b     3,69        ;0  x/2,y
  1353.              dc.b     85,69       ;1  coordinates of the cursor
  1354.              dc.b     168,69      ;2
  1355.              dc.b     250,69      ;3
  1356.              dc.b     3,104       ;4
  1357.              dc.b     113,104     ;5
  1358.              dc.b     223,104     ;6
  1359.              dc.b     3,130       ;7
  1360.              dc.b     113,130     ;8
  1361.              dc.b     223,130     ;9
  1362.              dc.b     3,156       ;10
  1363.              dc.b     113,156     ;11
  1364.              dc.b     223,156     ;12
  1365.              dc.b     16,182      ;13
  1366.              dc.b     126,182     ;14
  1367.              dc.b     236,182     ;15
  1368. ColourTab:   dc.w     $000,$000,$060,$0A0,$0F0,$036,$05A,$07F
  1369.              dc.w     $666,$AAA,$FFF,$FB0,$F00,$FFF,$800,$352
  1370. GameColTab:  dc.w     $000,$F00,$07F,$0F0,$FB0,$E09,$39D,$FF9
  1371. CopperTab:   dc.w     $DF0,$BF0,$9F0,$7F0,$5F0
  1372.              dc.w     $3F0,$1F0
  1373.              dc.w     $0F2,$0F4,$0F6,$0F8,$0FA
  1374.              dc.w     $0FC,$0FE
  1375.              dc.w     $0DF,$0BF,$09F,$07F,$05F
  1376.              dc.w     $03F,$01F
  1377.              dc.w     $20F,$40F,$60F,$80F,$A0F
  1378.              dc.w     $C0F,$E0F
  1379.              dc.w     $F0D,$F0B,$F09,$F07,$F05
  1380.              dc.w     $F03,$F01
  1381.              dc.w     $F20,$F40,$F60,$F80,$FA0
  1382.              dc.w     $FC0,$FE0,0,0
  1383. Topaz8:      dc.l     Topaz8name
  1384.              dc.w     8
  1385.              dc.b     0,1
  1386. MenScrStr:   dc.w     0,0,640,200,4
  1387.              dc.b     0,0
  1388.              dc.w     $8000,$F
  1389.              dc.l     Topaz8,0,0,0
  1390. GameScrStr:  dc.w     0,0,0,0,3
  1391.              dc.b     0,0
  1392.              dc.w     0,$F
  1393.              dc.l     Topaz8,0,0,0
  1394. Topaz8name:  dc.b     'topaz.font',0
  1395. Dosname:     dc.b     'dos.library',0
  1396. Gfxname:     dc.b     'graphics.library',0
  1397. Intname:     dc.b     'intuition.library',0
  1398. GadTxtTab:   dc.b     12,'Joystick 1 '
  1399.              dc.b      7,'Joystick 2 '
  1400.              dc.b      4,'Keyboard   '
  1401.              dc.b     11,'Number Pad '
  1402.              dc.b     'No Border  '
  1403.              dc.b     'PAL Screen '
  1404.              dc.b     'Explosion  '
  1405.              dc.b     'HighRes    '
  1406.              dc.b     'Interlace  '
  1407.              dc.b     'Speed      '
  1408.              dc.b     'Boxes      '
  1409.              dc.b     'Stars      '
  1410.              dc.b     'Savety Pods'
  1411.              dc.b     'P L A Y    '
  1412.              dc.b     ' CLEAR     '
  1413.              dc.b     'Q U I T    '
  1414. SavPodTxt:   dc.b     'Player 0 hit the savety pod!!'
  1415. ScrollTxt:   dc.b     '         sick amiga software unfortunetly presents:         '
  1416.              dc.b     '                a new implementation of TRON                '
  1417.              dc.b     '                t u r b o    M C P   V13.47                 '
  1418.              dc.b     '       written by Jörg Sixt in 100% assembly language       '
  1419.              dc.b     '            between December 1990 and April 1991            '
  1420.              dc.b     '         ....I know...I`m a lazy, lazy programmer...        '
  1421.              dc.b     '       IMPORTANT - ATTENTION - IMPORTANAT - ATTENTION       '
  1422.              dc.b     '               This programme is FREEWARE!!!                '
  1423.              dc.b     '            Use and copy   turbo MCP   for free!            '
  1424.              dc.b     '   But do not try to sell it nor to include it in any sort  '
  1425.              dc.b     '    of commercial product without my explicit permisson!!   '
  1426.              dc.b     '    However a small copy fee seems tolerable as far as it   '
  1427.              dc.b     ' doesn`t exceed the 5$/6DM-limit. Any kind of distribution  '
  1428.              dc.b     '      with higher output prices requires my agreement.      '
  1429.              dc.b     '           (c) by Jörg Sixt. All Rights reserved.           '
  1430.              dc.b     '   If you want such a permission or if you feel generous    '
  1431.              dc.b     '           enough to send a small donation to the           '
  1432.              dc.b     '          "a C-compiler for Jörg Sixt"-foundation,          '
  1433.              dc.b     '     or if you just want to contact me for fun`s sake       '
  1434.              dc.b     '                  here`s my address:                        '
  1435.              dc.b     ' Jörg Sixt   *   Tulpenstr. 2   *   W-8424 Saal  *   F.R.G. '
  1436.              dc.b     '            And now the obligatory greeting list:           '
  1437.              dc.b     ' Thanks to Charlie Gibbs,the man behind the incredible a68k '
  1438.              dc.b     '       *   Teijo Kinunnen (med)   *   Fred Fish   *         '
  1439.              dc.b     '     Alan Turing   *   Amiga Power Club Regensburg, etc.    '
  1440.              dc.b     ' Special mega hyper thanks to the `Amiga Special`-Magazine! '
  1441.              dc.b     '           Ok, that`s all for now! Happy playin`!           '
  1442.              dc.b     '                  Don`t forget to write!!                   '
  1443.              dc.b     0
  1444.  
  1445.  
  1446.              SECTION  GRAPHICS,DATA,CHIP
  1447.              even
  1448. ArrowIDat:   dc.w     $ff9f,$ff0f,$ff07,$0003,$0001,$0000
  1449.              dc.w     $0001,$0003,$ff07,$ff0f,$ff9f
  1450.              dc.w     0,0,0,0,0,0,0,0,0,0,0
  1451.              dc.w     0,0,0,0,0,0,0,0,0,0,0
  1452.              dc.w     0,0,0,0,0,0,0,0,0,0,0
  1453. ArrowIStr:   dc.w     0,0,16,11,4
  1454.              dc.l     ArrowIDat
  1455.              dc.b     15,0
  1456.              dc.l     0
  1457. LEDonIDat:   dc.w     0,0,0,$01c0,$00e0,$0020,$0020,0,0,0
  1458.              dc.w     0,0,0,0,0,0,0,0,0,0,0,0,0,$0380,$0fe0
  1459.              dc.w     $1ff0,$3ff8,$3ff8,$3ff8,$1ff0,$0fe0
  1460.              dc.w     $0380,0,$ffff,$ffff,$ffff,$ffff,$ffff
  1461.              dc.w     $ffff,$ffff,$ffff,$ffff,$ffff,$ffff
  1462. LEDonIStr:   dc.w     0,0,16,11,4
  1463.              dc.l     LEDonIDat
  1464.              dc.b     15,0
  1465.              dc.l     0
  1466. LEDoffIDat:  dc.w     0,0,0,$0080,$0040,0,0,0,0,0,0,0,$0380
  1467.              dc.w     $0fe0,$1f70,$3fb8,$3ff8,$3ff8,$1ff0
  1468.              dc.w     $0fe0,$0380,0,0,$0380,$0fe0,$1ff0,$3ff8
  1469.              dc.w     $3ff8,$3ff8,$1ff0,$0fe0,$0380,0,$ffff
  1470.              dc.w     $ffff,$ffff,$ffff,$ffff,$ffff,$ffff
  1471.              dc.w     $ffff,$ffff,$ffff,$ffff
  1472. LEDoffIStr:  dc.w     0,0,16,11,4
  1473.              dc.l     LEDoffIDat
  1474.              dc.b     15,0
  1475.              dc.l     0
  1476. BackgrIDat:  dc.w     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1477.              dc.w     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  1478.              dc.w     $ffff,$ffff,$ffff,$ffff,$ffff
  1479.              dc.w     $ffff,$ffff,$ffff,$ffff,$ffff,$ffff
  1480. BackgrIStr:  dc.w     0,0,16,11,4
  1481.              dc.l     BackgrIDat
  1482.              dc.b     15,0
  1483.              dc.l     0
  1484. PodIDat:     dc.w     $3c00,$6600,$cb00,$9f00,$8100,$fb00,$6600,$3c00
  1485.              dc.w     $3c00,$7e00,$ff00,$ff00,$ff00,$ff00,$7e00,$3c00
  1486.              dc.w     $3c00,$7e00,$ff00,$ff00,$ff00,$ff00,$7e00,$3c00
  1487. PodIStr:     dc.w     0,0,8,8,3
  1488.              dc.l     PodIDat
  1489.              dc.b     7,0
  1490.              dc.l     0
  1491. BoxIDat:     dc.w     $cc00,$6600,$3300,$9900,$cc00,$6600,$3300,$9900
  1492.              dc.w     $3300,$9900,$cc00,$6600,$3300,$9900,$cc00,$6600
  1493.              dc.w     $ff00,$ff00,$ff00,$ff00,$ff00,$ff00,$ff00,$ff00
  1494. BoxIStr:     dc.w     0,0,8,8,3
  1495.              dc.l     BoxIDat
  1496.              dc.b     7,0
  1497.              dc.l     0
  1498. TitleIStr:   dc.w     0,0,640,60,4
  1499.              dc.l     TitleIDat
  1500.              dc.b     15,0
  1501.              dc.l     0
  1502. TitleIDat:
  1503.              INCLUDE  "MCP.im"
  1504.              END
  1505.